<?php

include("mysql_conn.php");

$username = mysql_real_escape_string($_POST["username"]);
$fullname = mysql_real_escape_string($_POST["fullname"]);
$email = mysql_real_escape_string($_POST["email"]);
$active = mysql_real_escape_string($_POST["active"]);
$admin = mysql_real_escape_string($_POST["admin"]);
$boss = mysql_real_escape_string($_POST["boss"]);

$sql="insert into users (username, fullname, email, active, admin, boss)
values
('$username','$fullname','$email','$active', '$admin', '$boss')";

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }

// here is where we create the default non-project for every user
$sql2 = "insert into projects (username, submitter, title, origduedate, currduedate, state) values ('$username', '$username', 'Weekly Non-Project Status', '0000-00-00', '0000-00-00', '4')";

if (!mysql_query($sql2,$con))
  {
  die('Error: ' . mysql_error());
  }

echo "<html><head><meta http-equiv='refresh' content='0;url=userlist.php'></head><body>
User added successfully.<p>
<a href='userlist.php'>Return</a>
</body></html>";

mysql_close($con)
?> 
